package uni.androidgame;

import android.content.Context;
import android.graphics.Canvas;
import android.view.SurfaceHolder;

public class DrawThread extends Thread
{
    private boolean _isRunning = false;
    private final SurfaceHolder _surfaceHolder;
    private Context _context;
    private GameView _view;

    public DrawThread(SurfaceHolder surfaceHolder,Context context,GameView view)
    {
        _surfaceHolder=surfaceHolder;
        _context = context;
        _view = view;
    }

    public void set_isRunning(Boolean value)
    {
        _isRunning = value;
    }

    @Override
    public void run()
    {
        Canvas canvas;
        while (_isRunning)
        {
            canvas = null;


            try
            {
                canvas = _surfaceHolder.lockCanvas(null);
                synchronized (_surfaceHolder)
                {

                }
            }
            finally
            {
                if (canvas != null) {
                    _surfaceHolder.unlockCanvasAndPost(canvas);
                }
            }
        }
    }
}
